package org.example.controller;

import org.example.entity.ExamPaperEntity;
import org.example.service.ExamPaperInqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/exam_paper")
public class ExamPaperInqController {

    @Autowired
    private ExamPaperInqService examPaperInqService;


    // 获取所有试卷
    @GetMapping("/")
    public List<ExamPaperEntity> getAllExamPapers() {
        return examPaperInqService.getAllExamPapers();
    }

    // 根据试卷ID查询试卷
    @GetMapping("/{examId}")
    public ExamPaperEntity getExamPaperById(@PathVariable Integer examId) {
        return examPaperInqService.getExamPaperById(examId);
    }

    // 根据试卷名称查询试卷
    @GetMapping("/search")
    public List<ExamPaperEntity> getExamPaperByName(@RequestParam String examPaperName) {
        return examPaperInqService.getExamPaperByName(examPaperName);
    }
}

